package com.example.widgetcase.slice;


import com.example.widget_lib.widget.progress.circle.CircleProgressBarView;
import com.example.widgetcase.ResourceTable;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.utils.Color;

public class CircleProgressBarAbility extends BaseSlice {
    CircleProgressBarView oneCpbv;
    CircleProgressBarView twoCpbv;
    CircleProgressBarView threeCpbv;

    Button finishBtn;

    @Override
    public int getChildUIContent() {
        return ResourceTable.Layout_circle_progress_bar;
    }

    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        initView();
    }

    private void initView() {
        oneCpbv = (CircleProgressBarView) findComponentById(ResourceTable.Id_oneCpbv);
        oneCpbv.setProgressWithAnimation(0 / 1f);
        oneCpbv.setTargetNum(2345.00f + "");

        twoCpbv = (CircleProgressBarView) findComponentById(ResourceTable.Id_twoCpbv);
        twoCpbv.setProgressWithAnimation(249.0f);
        twoCpbv.setTargetNum(2345.00f + "");

        threeCpbv = (CircleProgressBarView) findComponentById(ResourceTable.Id_threeCpbv);
        threeCpbv.setProgressWithAnimation(49.4f);
        threeCpbv.setCenterProgressTextColor(Color.rgb(88, 181, 250));
        threeCpbv.setTargetNum(2345.00f + "");

        finishBtn = (Button) findComponentById(ResourceTable.Id_finishBtn);
        finishBtn.setClickedListener(v -> {
            threeCpbv.setProgressWithAnimation(249.4f);
        });
    }


}
